//
//  PKGroupGroupCell.m
//  PianKe
//
//  Created by lanou on 15/10/16.
//  Copyright (c) 2015年 李伟伟. All rights reserved.
//

#import "PKGroupGroupCell.h"
#import <UIImageView+WebCache.h>
@implementation PKGroupGroupCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titleCoverView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 10, 40, 40)];
        _titleCoverView.layer.cornerRadius = 20;
        _titleCoverView.layer.masksToBounds = YES;
        _titleCoverView.contentMode = UIViewContentModeScaleAspectFit;
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(65, 10, 100, 20)];
        
        _tagsLabel = [[UILabel alloc]initWithFrame:CGRectMake(65, 30, 200, 20)];
        _tagsLabel.font = [UIFont systemFontOfSize:14];
        _memberLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH-80, 30, 100, 20)];
        
    

        
        _unameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 150, 150, 20)];
        
        _updateLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH-120, 150, 140, 20)];
        
        [self.contentView addSubview:_titleCoverView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_tagsLabel];
        [self.contentView addSubview:_memberLabel];
        [self.contentView addSubview:_unameLabel];
        [self.contentView addSubview:_updateLabel];
    }
    return self;
}
-(void)configureGroupCell:(PKGroupGroupCellModel *)cellModel
{
//         NSArray *arr = @[@"1",@"2",@"3"];
//        NSString *str = [arr componentsJoinedByString:@"/"];
//        NSArray *array = [str componentsSeparatedByString:@"/"];
    _cellModel = cellModel;
    
    for (int i = 0; i < 4; i++) {
        _coverView = [[UIImageView alloc]initWithFrame:CGRectMake(20 + 85 * i, 60, 80, 80)];
        [_coverView sd_setImageWithURL:[NSURL URLWithString:[_cellModel.postArray[i] coverimg]]];
        [self.contentView addSubview:_coverView];
    }
    [_titleCoverView sd_setImageWithURL:[NSURL URLWithString:cellModel.coverimg]];
    _titleLabel.text = cellModel.title;
    _tagsLabel.text = [cellModel.tags componentsJoinedByString:@"/"];
    _memberLabel.text = [NSString stringWithFormat:@"%@", cellModel.membernum];
    _unameLabel.text = cellModel.userinfo.uname;
    _updateLabel.text = cellModel.lastupdate_f;
    
    

    
    
    
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
